package com.zhiwen.design.proxy.jdkProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Auther: wuzhiwen
 * @Date: 2018/12/3 13:06
 * @Description:
 */
public class DynamicSellHouseProxy implements InvocationHandler {

    private Object obj;

    public DynamicSellHouseProxy(Object obj) {
        this.obj = obj;
    }


    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("有人要卖房子了吗");
        Object invoke = method.invoke(obj, args);
        System.out.println("我们帮你买了");
        return invoke;
    }
}
